<%@page import="org.oexam.ostudy.struct.Questions"%>
<%@page import="org.oexam.ostudy.facade.ManageTestsPages"%>
<%@page import="org.oexam.ostudy.facade.struct.ViewAndAddQuestionsPageDisplayDetails"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"
	import="org.oexam.ostudy.facade.struct.LoggedUserDetails"
	import="org.oexam.ostudy.struct.Questions"
	import="org.oexam.ostudy.facade.struct.AddAndViewTestsDisplayDetails"
	import="org.oexam.ostudy.facade.ManageTestsPages"
	import="org.oexam.ostudy.facade.TestSetPages" import="java.util.List"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>View and Add Tests to Test Set</title>
<style type="text/css">
body {
	background-color: silver;
}

menu {
	border-style: solid;
	border-color: black;
	min-width: 700px min-height:    700px
}
</style>
</head>
<body>

	<table style="table-layout: auto; min-width: 700px;">
		<tr bgcolor="gray">
			<td colspan="2"><img src="University.gif"
				style="width: 90px; height: 35px" alt="No Image">
				<h1
					style="font-family: cursive; azimuth: left-side; color: #63382E;">
					EXAMPLE UNIVERSITY</h1> <span
				style="font-stretch: ultra-expanded; color: #63382E; font-family: cursive;">
					University Examination and Learning system </span></td>
			<td style="table-layout: auto; min-width: 100px;">
				<%
					LoggedUserDetails loggedUserDetails = (LoggedUserDetails) session
							.getAttribute("userLoginDetails");
				%> Logged in as, <%=loggedUserDetails.getUserName()%>. <br> <a
				href="Logout">logout</a>
			</td>


		</tr>


		<tr valign="top" style="height: 800px">



			<td style="width: 800px; height: 500px; border: thin;"
				bordercolor="black"><br> <%
 	if ((session.getAttribute("message") != null)) {
 %> <%=(String) session.getAttribute("message")%> <%
 	session.setAttribute("message", null);
 	}
				
	int testID = Integer.parseInt(request.getParameter("TestID"));
 %> <br> <br> 


				
				<hr>

				<h6>Add a question to this test</h6>
				<form method="post" action="ManageQuestions?TestID=<%=testID%>"
					style="border: thick;">
					<table>
						<tr>
							<td>Questions</td>
							
							<td>
							<textarea name="question" rows="5" cols="80"></textarea></td>
						</tr>
						<tr>
							<td>Option 1:</td>
							<td><input type="text" name="opt1" size="10"></td>
						</tr>
						<tr>
							<td>Option 2:</td>
							<td><input type="text" name="opt2" size="10"></td>
						</tr>
						<tr>
							<td>Option 3:</td>
							<td><input type="text" name="opt3" size="10"></td>
						</tr>
						<tr>
							<td>Option 4:</td>
							<td><input type="text" name="opt4" size="10"></td>
						</tr>
						
						<tr>
							<td>Option Number of the correct answer:</td>
							<td><input type="text" name="cans" size="2"></td>
						</tr>
						
						<tr>
							<td><input type="submit" value="Add"></td>
						</tr>
					</table>
				</form>
				<hr>
				<br><br><br>
				<table border="1" style="border: thin;" bordercolor="grey">
					<tr bgcolor="gray">
						<td>QuestionID</td>
						<td>Question</td>
						<td colspan="3">Actions</td>
					</tr>
					<%
					
				   ViewAndAddQuestionsPageDisplayDetails pageDetails = new ManageTestsPages().getVAQuestionPageDetails(testID);
						for (Questions question : pageDetails.getQuestionsList()) {

							String qid = Integer.toString(question.getQid());
					%>

					<tr>
						<td><%=qid%></td>
						<td><%=question.getQuestion()%></td>
						<td><a href="ViewAndAddTests?action=deleteTest&TID=<%=qid%>">Delete</a>
						</td>


						<%
							}
						%>
					
				</table> <br> <br> <br>
				
		<tr>
			<td colspan="3"
				style="background-color: #FFA513; text-align: center;">
				Copyright © 2011 www.exampleuniversity.com. All rights reserved.</td>
		</tr>
	</table>

</body>


</html>